package com.datalayer.utils.builder;

import com.datalayer.utils.AssociationType;

import java.lang.annotation.AnnotationTypeMismatchException;
import java.util.LinkedList;
import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * User: Georgiana.Scarlat
 * Date: 7/9/12
 * Time: 2:29 PM
 */
public class ResolveReferencesDirector {
    private Builder builder;

    public ResolveReferencesDirector(Builder builder) {
        this.builder = builder;
    }

    public <T> List<T> getReferences(AssociationType type) throws UnsupportedOperationException, AnnotationTypeMismatchException {

        List<T> result = new LinkedList<T>();
        switch (type) {
            case ON2ONE_REFERENCED:
                result = builder.getONE2ONE();
                break;
            case MANY2ONE:
                result = builder.getMANY2ONE();
                break;
            case MANY2MANY:
                /*To be continued*/
                break;
            default:
                break;
        }
        return result;
    }

}
